package com.itheima.springbootwebtlias.controller;

import com.itheima.springbootwebtlias.pojo.Result;
import com.itheima.springbootwebtlias.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    ReportService reportService;

    //员工统计
    @GetMapping("/empJobData")
    public Result jobCount(){
        //1.接收请求参数：无

        //2.调用业务层service的功能方法，查询职位统计数据
        Map jobOption = reportService.jobCount();
        //map.put("jobList",...)
        //map.put("dataList",...)

        //3.封装响应结果
        return Result.success(jobOption);
    }

    //性别统计
    @GetMapping("/empGenderData")
    public Result genderCount(){
        //1.接收参数:无

        //2.调用业务层service的功能方法，查询性别统计数据
        List<Map> map = reportService.genderCount();

        //3.封装响应结果
        return Result.success(map);
    }

    //班级人数统计
    @GetMapping("/studentCountData")
    public Result personCount(){
        Map map = reportService.studentCountData();
        return Result.success(map);
    }

    //学员学历统计
    @GetMapping("/studentDegreeData")
    public Result studentDegreeData(){
        List<Map> map = reportService.studentDegreeData();
        return Result.success(map);
    }
}
